#include "ShareMemory.hpp"
#include"Time.hpp"
#include"Fifo.hpp"
#include <iostream>
#include<cstring>
using namespace std;

int main()
{
    ShareMemory s;
    s.GetShm();
    cout << "shmid " << endl;
    sleep(5);
    s.AttachShm();
    fifo.OpenfifoWrite();
    //在这里IPC
    Image* img=(Image*)s.GetAddr();

    char c='A';
    while (c!='Z')
    {
        strcpy(img->status,"最新");
        strcpy(img->lasttime,GetCurrTime().c_str());
        strcpy(img->image,"XXXXXXXXXXXXXXXXXXXX");
        fifo.Sendfifo();
        sleep(3);
        c++;
    }
    

    //printf("虚拟地址是：%p\n",strinfo);


    sleep(5);
    s.DttachShm();
    return 0;
}

// int main()
// {
//     // 创建key

//     //cout << "shmid  :" << shmid << endl;
//     // 3

//     //4

//     sleep(10);
//     // 删除共享内存

//     return 0;
// }